package cn.muqingfeng.api.to;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

public class BaseArticle1TO implements Parcelable {

	@SerializedName("data")
	private BaseArticle1DataTO data;

	public BaseArticle1TO() {
	}

	public BaseArticle1TO(Parcel source) {
		data = source.readParcelable(BaseArticle1DataTO.class.getClassLoader());
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeParcelable(data, flags);
	}

	public static final Creator<BaseArticle1TO> CREATOR = new Creator<BaseArticle1TO>() {

		@Override
		public BaseArticle1TO[] newArray(int size) {
			return new BaseArticle1TO[size];
		}

		@Override
		public BaseArticle1TO createFromParcel(Parcel source) {
			return new BaseArticle1TO(source);
		}
	};

	public BaseArticle1DataTO getData() {
		return data;
	}

	public void setData(BaseArticle1DataTO data) {
		this.data = data;
	}

	public String toGsonString() {
		Gson gson = new Gson();
		return gson.toJson(this);
	}

	public List<Article1TO> getArticleList() {
		if (data == null) {
			return new ArrayList<Article1TO>();
		}
		return data.getList();
	}

}
